home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2006 May
/
PCWMAY06.iso
/
Software
/
Freeware
/
First Page 2006 3.00
/
fp2006-final-3.00-setup.exe
/
{app}
/
Iscripts
/
Forms Misc
/
field-focus.izs
< prev
next >
Wrap
Text File
|
2005-09-28
|
3KB
|
108 lines
<!NOWIZARD>
<!TITLE>Field Focus
<!/TITLE>
<!DESCRIPTION>A simple and small script to place focus on any form element you want when a page loads. <!/DESCRIPTION>
<!CATEGORY>Forms<!/CATEGORY>
<!SCRIPT>
<!-- START OF SCRIPT -->
<!-- HOW TO INSTALL FIELD FOCUS:
1. Copy code into the HEAD section of document
2. Add the onLoad event handler into the BODY tag
3. Put last coding into the BODY section of document -->
<!-- STEP ONE: Add code into HEAD section of document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- John Munn (jrmunn@home.com) -->
<!-- Begin
function putFocus(formInst, elementInst) {
if (document.forms.length > 0) {
document.forms[formInst].elements[elementInst].focus();
}
}
// The second number in the "onLoad" command in the body
// tag determines the form's focus. Counting starts with '0'
// End -->
</script>
</HEAD>
<!-- STEP TWO: Insert the onLoad event handler into your BODY tag -->
<BODY onLoad="putFocus(0,1);">
<!-- STEP THREE: Copy code into BODY section of document -->
<div align="center">
<form method="post" name="bogus" id="bogus-form">
<input type="text" name="bogus_field0" id="bogus_field0" size="20" maxlength="12"><br>
<input type="text" name="bogus_field1" id="bogus_field0" size="20" maxlength="12" value="Form focus is here!"><br>
<input type="text" name="bogus_field2" id="bogus_field0" size="20" maxlength="12">
</div>
<!-- END OF SCRIPT -->
<!/SCRIPT>
<!PREVIEW>
<!-- START OF SCRIPT -->
<!-- HOW TO INSTALL FIELD FOCUS:
1. Copy code into the HEAD section of document
2. Add the onLoad event handler into the BODY tag
3. Put last coding into the BODY section of document -->
<!-- STEP ONE: Add code into HEAD section of document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- John Munn (jrmunn@home.com) -->
<!-- Begin
function putFocus(formInst, elementInst) {
if (document.forms.length > 0) {
document.forms[formInst].elements[elementInst].focus();
}
}
// The second number in the "onLoad" command in the body
// tag determines the form's focus. Counting starts with '0'
// End -->
</script>
</HEAD>
<!-- STEP TWO: Insert the onLoad event handler into your BODY tag -->
<BODY onLoad="putFocus(0,1);">
<!-- STEP THREE: Copy code into BODY section of document -->
<div align="center">
<form method="post" name="bogus" id="bogus-form">
<input type="text" name="bogus_field0" id="bogus_field0" size="20" maxlength="12"><br>
<input type="text" name="bogus_field1" id="bogus_field0" size="20" maxlength="12" value="Form focus is here!"><br>
<input type="text" name="bogus_field2" id="bogus_field0" size="20" maxlength="12">
</div>
<!-- END OF SCRIPT -->
<!/PREVIEW>
<!RELATED>NONE<!/RELATED>